<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta content="text/html;charset=UTF-8" />
		<jsp:include page="/common/jc.jsp"></jsp:include>
		<title>网上商城</title>
		<script>
			$(function(){
$('input:radio[name=id]').click(function(el){
$('input:radio[name=id]').parents('li').removeClass() 
$(el.target).parents("li").addClass("selected");
var add=$("li input:radio[name='id']");
if(add[add.length-1].checked==true){
$('#newadd').show();
}else{
$('#newadd').hide();
}
})
})
		</script>
	</head>
	<body>
		<div class="wraper">
			<jsp:include page="/common/header.jsp"></jsp:include>
			<div class="content_buy">
				<div class="flow-steps ">
					<ol class="num5">
						<li class="current-prev">
							<span class="first">1.加入购物车</span>
						</li>
						<li class="current">
							<span>2.确认订单信息</span>
						</li>
						<li>
							<span>3.付款</span>
						</li>
						<li>
							<span>4.确认收货</span>
						</li>
						<li class="last">
							<span>5.完成</span>
						</li>
					</ol>
				</div>
				<form id="buy" action="${ctx}/member/shopcart/shop!buyAll.action"
					method="post">
					<div>
						<h2>
							确认收货地址信息
						</h2>
						<div id="address">
							<ul>
								<c:forEach items="${addresses.result}" var="item"
									varStatus="status">
									<li class="${status.count==1?'selected':''}">
										<label for="add${status.count }">
											<input type="radio" name="id" ${status.count==1?
												"checked='checked' ":''} value="${item.id }"
												id="add${status.count }" />
											${item.address}
											<em>(收货人：${item.name})</em>
										</label>
									</li>
								</c:forEach>
								<li class="${(empty addresses.result)?'selected':''}">
									<label for="add0">
										<input type="radio" name="id" ${(empty
											addresses.result)? "checked='checked' ":''}  value=""
											id="add0" />
										使用其它地址
									</label>
									<div class="form" id="newadd" ${(empty
										addresses.result)?'': 'style="display: none;"'}">
										<fieldset>
											<ul>
												<li>
													<label>
														地址：
													</label>
													<span> <em>*</em> <textarea rows="1" cols="110"
															name="address.address"></textarea>
														<div class="msg">
														</div> </span>
												</li>
												<li>
													<label>
														收货人姓名：
													</label>
													<span> <em>*</em> <input type="text"
															name="address.name" />
														<div></div> </span>
												</li>
												<li>
													<label>
														电话：
													</label>
													<span> <input type="text" name="address.postCode" />
														- <input type="text" name="address.telephone" /> 格式：区号 -
														电话号码 </span>
												</li>
												<li>
													<label>
														手机：
													</label>
													<span> <input type="text" name="address.mobilephone" />
														电话和手机请至少填写一个
														<div class="msg" style="display: none">
															<p class="error">
																必须由数字和 - 组成，总长度不能超过 25 位；且电话和手机至少填写一项
															</p>
														</div> </span>
												</li>
											</ul>
										</fieldset>
									</div>
								</li>
							</ul>
						</div>
					</div>

					<div>
						<h2>
							确认订单信息
						</h2>
						<div class="first_step">
							<div id="cart">
								<table class="cart-table" cellspacing="0" cellpadding="0">
									<colgroup valign="middle">
										<col width="" />
										<col width="100" />
										<col width="150" />
										<col width="100" />
										<col width="100" />
										<col width="116" />
									</colgroup>
									<thead>
										<tr>
											<th class="s-title">
												店铺宝贝
											</th>
											<th class="s-point">
												获积分
											</th>
											<th class="s-price">
												单价(元)
											</th>
											<th class="s-amount">
												数量
											</th>
											<th class="s-agio">
												优惠
											</th>
											<th class="s-total">
												合计(元)
											</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${scList}" var="item">
											<tr class="uncod selected">
												<td class="s-title">
													<a title="${item.goodsInfo.goodsName}" target="_blank"
														href="${ctx}/pub/goods/goods!getGoodDetail.action?id=${item.goodsInfo.id }">
														<img class="sp2" src="${ctx}/${item.goodsInfo.goodsUrl}" />
														${item.goodsInfo.goodsName} </a>
												</td>
												<td class="s-point">
													<em> <fmt:formatNumber
															value="${item.goodsInfo.memberPrice/100}" pattern="#" />
													</em>
												</td>
												<td class="s-price">
													<em>${item.goodsInfo.memberPrice}</em>
												</td>
												<td class="s-amount">
													<!-- <input class="text text-amount" type="text" data-now="1"
												data-max="100" value="1" /> -->
													${item.num}
												</td>
												<td class="s-agio">
													${(item.goodsInfo.marketPrice-item.goodsInfo.memberPrice)*item.num}
												</td>
												<td class="s-total">
													<em>${item.sumPrice}</em>
												</td>
											</tr>
										</c:forEach>

									</tbody>
									<tfoot>
										<tr>
											<td class="go" colspan="8">
												<a href="${ctx}/member/shopcart/shop!getShopCartList"
													class="btn_back"><span>返回</span> </a>
												<input class="btn_buy" type="submit" value="" />
											</td>
										</tr>
									</tfoot>
								</table>
							</div>
						</div>
					</div>
				</form>
			</div>
			<jsp:include page="/common/footer.jsp"></jsp:include>
		</div>
	</body>
</html>
